package com.wzgl.core.baseModel;

import java.util.Date;

import com.jfinal.plugin.activerecord.IBean;
import com.jfinal.plugin.ehcache.CacheKit;
import com.jfinal.plugin.ehcache.IDataLoader;
import com.wzgl.core.base.JModel;
import com.wzgl.message.MessageKit;

@SuppressWarnings("serial")
public class BaseSendLogo <M extends BaseSendLogo<M>> extends JModel<M> implements IBean {
	public static final String CACHE_NAME = "sendlogo";
	public static final String METADATA_TYPE = "sendlogo";

	public static final String ACTION_ADD = "sendlogo:add";
	public static final String ACTION_DELETE = "sendlogo:delete";
	public static final String ACTION_UPDATE = "sendlogo:update";
	
	public void removeCache(Object key){
		if(key == null) return;
		CacheKit.remove(CACHE_NAME, key);
	}

	public void putCache(Object key,Object value){
		CacheKit.put(CACHE_NAME, key, value);
	}

	public M getCache(Object key){
		return CacheKit.get(CACHE_NAME, key);
	}

	public M getCache(Object key,IDataLoader dataloader){
		return CacheKit.get(CACHE_NAME, key, dataloader);
	}

	@Override
	public boolean save() {
		boolean saved = super.save();
		if (saved) { MessageKit.sendMessage(ACTION_ADD, this); }
		return saved;
	}

	@Override
	public boolean delete() {
		boolean deleted = super.delete();
		if (deleted) { MessageKit.sendMessage(ACTION_DELETE, this); }
		return deleted;
	}

	@Override
	public boolean deleteById(Object idValue) {
		boolean deleted = super.deleteById(idValue);
		if (deleted) { MessageKit.sendMessage(ACTION_DELETE, this); }
		return deleted;
	}

	@Override
	public boolean update() {
		boolean update = super.update();
		if (update) { MessageKit.sendMessage(ACTION_UPDATE, this); }
		return update;
	}
	
	public void setFid(java.lang.String id) {
		set("fid", id);
	}

	public java.lang.String getFid() {
		Object id = get("fid");
		if (id == null)
			return null;
		return id.toString();
	}
	
	public void setFtnews_id(java.lang.String ftnews_id) {
		set("ftnews_id", ftnews_id);
	}
	public java.lang.String getFtnews_id() {
		return get("ftnews_id");
	}
	
	public void setFtnewsex_id(java.lang.String ftnewsex_id) {
		set("ftnewsex_id", ftnewsex_id);
	}
	public java.lang.String getFtnewsex_id() {
		return get("ftnewsex_id");
	}
	
	//发布时间
	public void setFsendtime(Date fsendtime) {
		set("fsendtime", fsendtime);
	}
	public Date getFsendtime() {
		return get("fsendtime");
	}
	
	//文章
	public void setFgrid_id(java.lang.String fgrid_id) {
		set("fgrid_id", fgrid_id);
	}
	public java.lang.String getFgrid_id() {
		return get("fgrid_id");
	}
	
	//去向
	public void setFdirection_id(java.lang.String fdirection_id) {
		set("fdirection_id", fdirection_id);
	}
	public java.lang.String getFdirection_id() {
		return get("fdirection_id");
	}
	
}
